package LibraryManagementSystem.user;

import LibraryManagementSystem.IOperation;
import LibraryManagementSystem.impl.BorrowOperation;
import LibraryManagementSystem.impl.FindOperation;
import LibraryManagementSystem.impl.ListOperation;
import LibraryManagementSystem.impl.ReturnOperation;

import java.util.Scanner;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/10/22 8:27
 */
public class NormalUser extends User {

    public NormalUser(String name) {
        this.name = name;
        operations = new IOperation[]{
                new ListOperation(),
                new FindOperation(),
                new BorrowOperation(),
                new ReturnOperation()
        };
    }

    @Override
    public int menu() {
        System.out.println("$$$$$$$$$$$$$$$$$$$$$$$");
        System.out.println("欢迎用户" + this.name + "登录牛牛图书管理系统");
        System.out.println("1.显示当前书籍列表");
        System.out.println("2.查询书籍");
        System.out.println("3.借阅书籍");
        System.out.println("4.归还书籍");
        System.out.println("-1.退出");
        System.out.println("请输入您的选择:");
        int choice = scanner.nextInt();
        System.out.println("$$$$$$$$$$$$$$$$$$$$$$$");
        if (choice == -1) {
            close();
            System.out.println("您已退出系统，祝您生活愉快！");
        }
        return choice;
    }

    public void close() {
        scanner.close();
    }
}
